<div class="action-dialog-model-fixed-body">
	<div class="detailsBox">
		<div class="openBox">
			<h3>
			<i class="jtIco"></i>添加经销商合作方</h3>
	        <div class="detaiTab">
	        	<form class="action-ajax-form" action="/jxsPartner/rest/add" method="post" id="addForm"  class="action-ajax-form action-ajax-form-valid">
	            <input type="hidden" name="id" value="${vo.id}"></td>
	            <input type="hidden" name="brandId" value="${brandId}"></td>
	            <input type="hidden" name="wfStatus" value="${vo.wfStatus}"></td>

	            <table width="100%" border="0" cellspacing="0" cellpadding="0">
	            	<tbody>
	            		<tr><td align="left" class="bg" width="15%" colspan="4" style="background: #e2e2e2;font-weight: bold;padding-left: 20px;color: #333;font-size: 14px";>申请信息</td></tr>
                        <tr>
                            <td width="15%" align="right" class="bg">品牌名称:</td>
                            <td width="35%">
                                <input type="text" name="partnerName" disabled="disabled" value="${brand.brandName}">
                            </td>
                        </tr>
						<tr>
	                    	<td align="right" class="bg" width="15%">申报省份<span style="color: red;">*</span></td>
	                      	<td width="35%">
	                        	<select name="orgProvinceId" id="orgProvinceId">
	                        		<option  value="">请选择
	                        		<#list ActOrgEntitys as ActOrgEntity>
	                        			<option value="${ActOrgEntity.orgId}_${ActOrgEntity.orgName}" <#if ActOrgEntity.orgId == vo.orgProvinceId>selected="selected" </#if>>${ActOrgEntity.orgName}
	                        		</#list>
	                        	</select>
	                        <td align="right" class="bg" width="15%">经办人<span style="color: red;">*</span></td>
	                        <td>
	                        	<input type="text" id="operator" name="operator" readonly="readonly" value="${currentUser}" class="action-valid-field" data-action-valid-rule="required;" data-action-valid-msg-required="经办人不能为空！">
	                        	 <span class="action-field-error" for="operator" style="color:red;"></span>
	                        	<input type="hidden" name="operatorId"  value="${currentUserCode}">
	                        </td>
	                    </tr>   
	                    <tr>
	                      	<td align="right" class="bg" width="15%">一批商分类</td>
                            <td>
                                <input type="text" name="batchClassification" readonly="readonly" value="${batchClassification}">
                            </td>
                            <td align="right" class="bg" width="15%">渠道共享</td>
                            <td >
                                <select id="isShare" name="isShare">
                                    <option value="0" <#if vo.isShare=0>selected="selected" </#if>>否</option>
                                    <option value="1" <#if vo.isShare=1>selected="selected" </#if>>是</option>
                                </select>
                            </td>
	                    </tr>

	            		<tr><td align="left" class="bg" width="15%" colspan="4" style="background: #e2e2e2;font-weight: bold;padding-left: 20px;color: #333;font-size: 14px";>品牌经营模式</td></tr>
	                	<tr>
	                    	<td align="right" class="bg" width="15%">销售链条结构<span style="color: red;">*</span></td>
	                      	<td width="35%" colspan="3">
	                      		<textarea name="salesChainStructure" cols="50" rows="5" placeholder="厂家--厂家自有代理--地区一批">${vo.salesChainStructure}</textarea>
	                      	</td>
	                    </tr>
	                    <tr>
	                      	<td align="right" class="bg" width="15%">申报地区一批商情况</td>
	                    	<td colspan="3">
	                    		<textarea name="salesPatternCondition" size="500" cols="50" rows="5" placeholder="地区一批商数量、地区任务数、品牌对一批商的销售策略（返点、费用、促销费用等结算周期、返点形式），近年任务完成情况及任务增长率">${vo.salesPatternCondition}</textarea>
	                    	</td>
	                    </tr>
	                    
	                    
	                    <tr><td align="left" class="bg" width="15%" colspan="4" style="background: #e2e2e2;font-weight: bold;padding-left: 20px;color: #333;font-size: 14px";>一批商基本情况</td></tr>
	                    <tr>
	                    	<td align="right" class="bg" width="15%">营业执照名称<span style="color: red;">*</span></td>
	                      	<td width="35%">
	                      		<input type="text" id="businessLicenseName"  name="businessLicenseName" value="${vo.businessLicenseName}" class="action-valid-field" data-action-valid-rule="required;maxlength:20;" data-action-valid-msg-required="营业执照名称不能为空！"  autocomplete="off">
	                      		<span class="action-field-error" for="businessLicenseName" style="color:red;"></span>
                      		</td>
	                     	<td align="right" class="bg" width="15%">营业执照号<span style="color: red;">*</span></td>
	                        <td>
	                        	<input type="text" id="businessLicenseNo"   name="businessLicenseNo"  value="${vo.businessLicenseNo}" class="action-valid-field" data-action-valid-rule="required;maxlength:20;" data-action-valid-msg-required="营业执照号不能为空！"  autocomplete="off">
	                        	<span class="action-field-error" for="businessLicenseNo" style="color:red;"></span>
	                        </td>
	                    </tr>
	                    <tr>
	                    	<td align="right" class="bg" width="15%">法人代表姓名<span style="color: red;">*</span></td>
	                      	<td width="35%">
	                      		<input type="text" name="corporationName" id="corporationName"  value="${vo.corporationName}" class="action-valid-field" data-action-valid-rule="required;maxlength:5;" data-action-valid-msg-required="法人代表姓名不能为空！"  autocomplete="off">
	                      		<span class="action-field-error" for="corporationName" style="color:red;"></span>
                      		</td>
	                     	<td align="right" class="bg" width="15%">成立时间<span style="color: red;">*</span></td>
	                        <td>
	                        	<@date name="foundingTime"  id="foundingTime"  class="tabInp" value="${(vo.foundingTime?string('yyyy-MM-dd'))!''}"    class="action-valid-field"  data\-action\-valid\-rule="required;"   data\-action\-valid\-msg\-required="成立时间不能为空！"/>
	                       		<span class="action-field-error" for="foundingTime" style="color:red;"></span>
	                        </td>
	                    </tr>
	                    <tr>
	                      	<td align="right" class="bg" width="15%">注册资本<span style="color: red;">*</span></td>
	                    	<td colspan="3">
	                    		<input type="text" name="registeredCapital" id="registeredCapital"  value="${vo.registeredCapital}" class="action-valid-field" data-action-valid-rule="required;maxlength:10;number;" data-action-valid-msg-required="注册资本不能为空！"  autocomplete="off">
	                    		<span class="action-field-error" for="registeredCapital" style="color:red;"></span>
	                    	</td>
	                    </tr>
	                    <tr>
	                    	<td align="right" class="bg" width="15%">经营地址<span style="color: red;">*</span></td>
	                    	<td colspan="3">
	                    	<#if vo.wfStatus != 0 && vo.wfStatus != 2>
	                    		<select id="select_provinceId" name="manageProvince" value="${vo.manageProvince}" onchange="provinceOnchange()"></select>&nbsp;&nbsp; 
	                    		<select id="select_areaId" name="manageArea" value="${vo.manageArea}" onchange="areaOnchange()"></select>&nbsp;&nbsp; 
	                    		<select id="select_cityId" name="manageCity" value="${vo.manageCity}" ></select>
	                    		<input type="text" name="manageDetail" value="${vo.manageDetail}">
	                    	<#else>
	                    		*********
	                    	  <@permission permissionName="jxsPartner_sensitive">
	                    		<a class="action-ajax-btn fr edit btn_blue" href="/jxsPartner/rest/show_window?partnerId=${vo.id}">查看</a>
	                    	  </@permission>
	                    	</#if>
	                    	</td>
	                    </tr>
	                    <tr>
	                    	<td align="right" class="bg" width="15%">仓库面积<span style="color: red;">*</span></td>
	                      	<td width="35%">
	                      		<input type="text" id="warehouseArea" name="warehouseArea" value="${vo.warehouseArea}" class="action-valid-field" data-action-valid-rule="required;maxlength:5;number;" data-action-valid-msg-required="仓库面积不能为空！"  autocomplete="off">平方米
	                      		<span class="action-field-error" for="warehouseArea" style="color:red;"></span>
                      		</td>
	                     	<td align="right" class="bg" width="15%">运输车辆数<span style="color: red;">*</span></td>
	                        <td>
	                        	<input type="text" name="transportVehiclesNum" id="transportVehiclesNum"  value="${vo.transportVehiclesNum}"  class="action-valid-field" data-action-valid-rule="required;maxlength:5;number;" data-action-valid-msg-required="运输车辆数不能为空！"  autocomplete="off">辆
	                        	<span class="action-field-error" for="transportVehiclesNum" style="color:red;"></span>
	                        </td>
	                    </tr>
	                    <tr>
	                    	<td align="right" class="bg" width="15%">与品牌合作时长<span style="color: red;">*</span></td>
	                      	<td width="35%">
	                      		<input type="text" name="brandCooperationTerm" id="brandCooperationTerm" value="${vo.brandCooperationTerm}" class="action-valid-field" data-action-valid-rule="required;maxlength:5;number;" data-action-valid-msg-required="与品牌合作时长不能为空！"  autocomplete="off">年
	                      		<span class="action-field-error" for="brandCooperationTerm" style="color:red;"></span>
                      		</td>
	                     	<td align="right" class="bg" width="15%">代理其他品牌数量<span style="color: red;">*</span></td>
	                        <td>
	                        	<input type="text" name="otherBrandNum" id="otherBrandNum"  value="${vo.otherBrandNum}"  class="action-valid-field" data-action-valid-rule="required;maxlength:5;number;" data-action-valid-msg-required="代理其他品牌数量不能为空！"  autocomplete="off">
	                        	<span class="action-field-error" for="otherBrandNum" style="color:red;"></span>
	                        </td>
	                    </tr>
	                    <tr>
	                    	<td align="right" class="bg" width="15%">品牌授权期限<span style="color: red;">*</span></td>
	                      	<td colspan="3">
	                      		<input type="text" name="brandLicensingDeadline" id="brandLicensingDeadline"  value="${vo.brandLicensingDeadline}"  class="action-valid-field" data-action-valid-rule="required;maxlength:5;number;" data-action-valid-msg-required="品牌授权期限不能为空！"  autocomplete="off">年
	                      		<span class="action-field-error" for="brandLicensingDeadline" style="color:red;"></span>
                      		</td>
	                    </tr>
	                    <tr>
	                    	<td align="right" class="bg" width="15%">代理的其他三大品牌<span style="color: red;">*</span></td>
	                      	<td width="35%">
	                      		<input type="text" name="agencyOtherBrand" id="agencyOtherBrand"  value="${vo.agencyOtherBrand}"  class="action-valid-field" data-action-valid-rule="maxlength:30;"  autocomplete="off">
	                      		<span class="action-field-error" for="agencyOtherBrand" style="color:red;"></span>
                      		</td>
	                     	<td align="right" class="bg" width="15%">本一批商下游二批商数量<span style="color: red;">*</span></td>
	                        <td>
	                        	<input type="text" name="downstreamTwoPattern" id="downstreamTwoPattern" value="${vo.downstreamTwoPattern}"  class="action-valid-field" data-action-valid-rule="required;maxlength:5;number;" data-action-valid-msg-required="本一批商下游二批商数量不能为空！"  autocomplete="off">
	                        	<span class="action-field-error" for="downstreamTwoPattern" style="color:red;"></span>
	                        </td>
	                    </tr>
	                    <tr>
	                    	<td align="right" class="bg" width="15%">融资额度</td>
	                      	<td colspan="3">
	                      		<input type="text" name="financingLimit" id="financingLimit"  value="${vo.financingLimit}" class="action-valid-field" data-action-valid-rule="maxlength:5;number;"   autocomplete="off">万元
	                      		<span class="action-field-error" for="financingLimit" style="color:red;"></span>
                      		</td>
	                    </tr>
	                    <tr>
	                    	<td align="right" class="bg" width="15%">年销售额<span style="color: red;">*</span></td>
	                      	<td colspan="3">
	                      		<input type="text" name="annualSales" id="annualSales" value="${vo.annualSales}" class="action-valid-field" data-action-valid-rule="required;maxlength:5;number;"   data-action-valid-msg-required="年销售额不能为空！"  autocomplete="off">万元
	                      		<span class="action-field-error" for="annualSales" style="color:red;"></span>
                      		</td>
	                    </tr>
	                    <tr>
	                        <td align="right" class="bg" width="15%">品牌对一批商授权经营区域<span style="color: red;">*</span></td>
	                        <td colspan="3">
	                      		<@select type="radio" value="${vo.brandLicensingArea}" class="only" name="brandLicensingArea" id="brandLicensingArea"  dataSouceType="jxs_brand_licensing_area"  class="action-valid-field"
                           data\-action\-valid\-rule="required;" data\-action\-valid\-msg\-required="品牌对一批商授权经营区域不能为空！" />
                           <span class="action-field-error" for="brandLicensingArea" style="color:red;"></span>
	                        </td>
	                    </tr>
	                    <tr>
	                        <td align="right" class="bg" width="15%">品牌对一批商授权经营渠道</td>
	                        <td colspan="3">
	                      		<@select type="radio" value="${vo.brandLicensingChannel}" class="only" name="brandLicensingChannel" dataSouceType="jxs_brand_licensing_channel"/>
	                        </td>
	                    </tr>
	                    <tr>
	                    	<td></td>
	                      	<td align="center" class="bg" width="30%">2015年</td>
	                     	<td align="center" class="bg" width="30%">2016年</td>
	                        <td align="center" class="bg" width="30%">2017年</td>
	                    </tr>
	                    <tr>
	                    	<td align="right" class="bg" width="15%">近三年任务数</td>
	                    	<td align="center" width="30%">
	                    		<input type="text" name="nearlyThreeYearTask1" id="nearlyThreeYearTask1" value="${vo.nearlyThreeYearTask1}" class="action-valid-field" data-action-valid-rule="maxlength:10;number;"   autocomplete="off">万元
	                    		<span class="action-field-error" for="nearlyThreeYearTask1" style="color:red;"></span>
	                    	</td>
	                     	<td align="center" width="30%">
	                     		<input type="text" name="nearlyThreeYearTask2" id="nearlyThreeYearTask2" value="${vo.nearlyThreeYearTask2}" class="action-valid-field" data-action-valid-rule="maxlength:10;number;"   autocomplete="off">万元
	                     		<span class="action-field-error" for="nearlyThreeYearTask2" style="color:red;"></span>
	                     	</td>
	                        <td align="center" width="30%">
	                       		 <input type="text" name="nearlyThreeYearTask3" id="nearlyThreeYearTask3" value="${vo.nearlyThreeYearTask3}" class="action-valid-field" data-action-valid-rule="maxlength:10;number;"   autocomplete="off">万元
	                       		 <span class="action-field-error" for="nearlyThreeYearTask3" style="color:red;"></span>
	                        </td>
	                    </tr>
	                    <tr>
	                    	<td align="right" class="bg" width="15%">任务完成率</td>
	                      	<td align="center" width="30%">
	                      		<input type="text" name="taskCompletionRate1" id="taskCompletionRate1" value="${vo.taskCompletionRate1}" class="action-valid-field" data-action-valid-rule="number;reg:^\d+(.\d{1})?$;"   autocomplete="off">%
	                      		 <span class="action-field-error" for="taskCompletionRate1" style="color:red;"></span>
	                      	</td>
	                     	<td align="center" width="30%">
	                     		<input type="text" name="taskCompletionRate2" id="taskCompletionRate2" value="${vo.taskCompletionRate2}" class="action-valid-field" data-action-valid-rule="number;reg:^\d+(.\d{1})?$;"   autocomplete="off">%
	                     		 <span class="action-field-error" for="taskCompletionRate2" style="color:red;"></span>
	                     	</td>
	                        <td align="center" width="30%">
	                        	<input type="text" name="taskCompletionRate3" id="taskCompletionRate3" value="${vo.taskCompletionRate3}" class="action-valid-field" data-action-valid-rule="number;reg:^\d+(.\d{1})?$;"   autocomplete="off">%
	                        	 <span class="action-field-error" for="taskCompletionRate3" style="color:red;"></span>
	                        </td>
	                    </tr>
	                    <tr>
	                    	<td align="right" class="bg" width="15%">在本地区一批商中销售占比</td>
	                      	<td width="35%">
	                      		<input type="text" name="accountRate" id="accountRate" value="${vo.accountRate}" class="action-valid-field" data-action-valid-rule="number;reg:^\d+(.\d{1})?$;"   autocomplete="off">%
	                      		<span class="action-field-error" for="accountRate" style="color:red;"></span>
                      		</td>
	                     	<td align="right" class="bg" width="15%">毛利率/净利率</td>
	                        <td>
	                        	<input type="text" name="grossNetRate" id="grossNetRate" value="${vo.grossNetRate}" class="action-valid-field" data-action-valid-rule="number;reg:^\d+(.\d{1})?$;"   autocomplete="off">%
	                        	<span class="action-field-error" for="grossNetRate" style="color:red;"></span>
	                        </td>
	                    </tr>
	                    <tr>
	                        <td align="right" class="bg" width="15%">原贷款单号</td>
	                        <td colspan="3">
	                      		<input type="text" name="originalBillCode" value="${vo.originalBillCode}">
	                        </td>
	                    </tr>
	                    <tr>
	                    	<td align="right" class="bg" width="15%">一批商对二批商的销售策略</td>
	                      	<td colspan="3">
	                    		<textarea name="salesStrategy" size="500" cols="50" rows="5" placeholder="厂家费用分配比例和折扣及实现形式和发放时间、是否有赊销、赊销一般账期">${vo.salesStrategy}</textarea>
	                    	</td>
	                    </tr>
	                    <tr>
	                    	<td align="right" class="bg" width="15%">备注</td>
	                      	<td colspan="3">
	                    		<textarea name="remark" cols="50" rows="5" >${vo.remark}</textarea>
	                    	</td>
	                    </tr>
	                    
	                    
	                    <tr><td align="left" class="bg" width="15%" colspan="4" style="background: #e2e2e2;font-weight: bold;padding-left: 20px;color: #333;font-size: 14px";>担保方式</td></tr>
	                    <tr>
	                        <td align="right" class="bg" width="15%">担保方式</td>
	                        <td colspan="3">
	                      		<@select type="radio" value="${vo.guaranteeMethod}" class="only" name="guaranteeMethod" dataSouceType="jxs_guarantee_method"/>
	                        </td>
	                    </tr>
	                    
	                    <tr><td align="left" class="bg" width="15%" colspan="4" style="background: #e2e2e2;font-weight: bold;padding-left: 20px;color: #333;font-size: 14px";>定向支付</td></tr>
	                    <tr>
	                        <td align="right" class="bg" width="15%">资金使用情况</td>
	                        <td colspan="3">
	                      		<@select type="radio" dataSouceType="YW" class="tabInp" name="fundUsage" value="${vo.fundUsage}" />
	                      		对象<input type="text" style="width:25px" name="fundUsageObject" value="${vo.fundUsageObject}"> 
	                      		比例<input type="text" style="width:25px" name="fundUsageRate" id="fundUsageRate"  value="${vo.fundUsageRate}"  class="action-valid-field" data-action-valid-rule="number;reg:^\d+(.\d{1})?$;"   autocomplete="off">%
	                      		<span class="action-field-error" for="fundUsageRate" style="color:red;"></span>
	                        </td>
	                    </tr>
	                    
	                    <tr><td align="left" class="bg" width="15%" colspan="4" style="background: #e2e2e2;font-weight: bold;padding-left: 20px;color: #333;font-size: 14px";>结论</td></tr>
	                    <tr>
	                    	<td align="right" class="bg" width="15%">结论说明</td>
	                      	<td colspan="3">
	                    		<textarea name="conclusionDesc"  size="500" cols="50" rows="5" placeholder="包括但不限于：一批商的实力、履约水平、管理水平、行业口碑、品牌任务完成情况等">${vo.conclusionDesc}</textarea>
	                    	</td>
	                    </tr>
	               	</tbody>
	        	</table>
	        	<#if vo.id??>
		        	<div class="openBox action-ajax-load" data-url="<@url value='/jxsPartner/rest/loadfile?parameter=${vo.id}&wfStatus=${vo.wfStatus}'/>"></div>
		        	<#if vo.wfStatus != -1>
		        		<div class="action-ajax-load detailsBox" data-url="<@url value='${agreeUrl}' />">审核历史加载中。。。</div>
		        	</#if>
	        	</#if>
	        	<#if vo.wfStatus != 0 && vo.wfStatus != 2>
		        	<div class=" mtb20 tac" >
					<@permission permissionName="editJxsPartner">
						<input type="submit" class="btn_auto_30 btn_blue" value="保 存">
					</@permission>
						<#if vo.id??>
							<@permission permissionName="delJxsPartner">
								<a href="/jxsPartner/rest/delete?partnerId=${vo.id}" class="action-ajax-btn btn_auto_30 btn_blue">删除</a>
							</@permission>
							<@permission permissionName="startJxsPartnerFlow">
								<a href="/jxsPartner/rest/jxsStartFlow?id=${vo.id}" class="action-ajax-btn btn_auto_30 btn_blue">发起流程</a>
							</@permission>
			        	</#if>
					</div>
				</#if>
	        </form>
	        </div>
        </div>
	</div>
</div>
<div id="showMsgDiv" class="tcTxt1 smDiv" style="display:none;">
    <div class="tcjz"></div>
</div>
 <script>
	$("#addForm").submit(function(e){
	  return validate();
	});
 
 	function validate() {
 		var numRe = /^[0-9]*$/;
 		var flRe = /^[0-9]+([.]{1}[0-9]+){0,1}$/;
 		var orgProvinceId = $("#orgProvinceId").val();
 		if (orgProvinceId == null || orgProvinceId == "") {
  			$.actionDialog({message : "请填写申报省份"});
 			return false;		
 		} 	
 		var businessLicenseName =  $("#addForm input[name='businessLicenseName']").val();
 		if (!businessLicenseName) {
 			$.actionDialog({message : "请填写营业执照名称"});
 			return false;
 		}
 		var businessLicenseNo =  $("#addForm input[name='businessLicenseNo']").val();
 		if (!businessLicenseNo) {
 			$.actionDialog({message : "请填写营业执照号"});
 			return false;
 		}
 		var salesChainStructure =  $("#addForm textarea[name='salesChainStructure']").val();
 		if (!salesChainStructure) {
 			$.actionDialog({message : "请填写销售链条结构"});
 			return false;
 		}
 		var corporationName =  $("#addForm input[name='corporationName']").val();
 		if (!corporationName) {
 			$.actionDialog({message : "请填写法人代表姓名"});
 			return false;
 		}
 		var foundingTime =  $("#addForm input[name='foundingTime']").val();
 		if (!foundingTime) {
 			$.actionDialog({message : "请填写成立时间"});
 			return false;
 		}
 		var registeredCapital =  $("#addForm input[name='registeredCapital']").val();
 		if (!registeredCapital || !numRe.test(registeredCapital)) {
 			$.actionDialog({message : "注册资本为空或格式不对"});
 			return false;
 		}
 		var select_provinceId =  $("#addForm #select_provinceId").val();
 		var select_areaId =  $("#addForm #select_areaId").val();
 		var select_cityId =  $("#addForm #select_cityId").val();
 		var select_provinceId =  $("#addForm input[name='manageDetail']").val();
 		if (!select_provinceId && !select_areaId && !select_cityId && !select_provinceId) {
 			$.actionDialog({message : "请填写经营地址"});
 			return false;
 		}
 		var warehouseArea =  $("#addForm input[name='warehouseArea']").val();
 		if (!warehouseArea || !numRe.test(warehouseArea)) {
 			$.actionDialog({message : "仓库面积为空或格式不对"});
 			return false;
 		}
 		var transportVehiclesNum =  $("#addForm input[name='transportVehiclesNum']").val();
 		if (!transportVehiclesNum || !numRe.test(transportVehiclesNum)) {
 			$.actionDialog({message : "运输车辆数为空或格式不对"});
 			return false;
 		}
 		var brandCooperationTerm =  $("#addForm input[name='brandCooperationTerm']").val();
 		if (!brandCooperationTerm || !numRe.test(brandCooperationTerm)) {
 			$.actionDialog({message : "与品牌合作时长为空或格式不对"});
 			return false;
 		}
 		var otherBrandNum =  $("#addForm input[name='otherBrandNum']").val();
 		if (!otherBrandNum || !numRe.test(otherBrandNum)) {
 			$.actionDialog({message : "代理其他品牌数量为空或格式不对"});
 			return false;
 		}
 		var brandLicensingDeadline =  $("#addForm input[name='brandLicensingDeadline']").val();
 		if (!brandLicensingDeadline || !numRe.test(brandLicensingDeadline)) {
 			$.actionDialog({message : "品牌授权期限为空或格式不对"});
 			return false;
 		}
 		var agencyOtherBrand =  $("#addForm input[name='agencyOtherBrand']").val();
 		if (!agencyOtherBrand) {
 			$.actionDialog({message : "请填写代理的其他三大品牌"});
 			return false;
 		}
 		var downstreamTwoPattern =  $("#addForm input[name='downstreamTwoPattern']").val();
 		if (!downstreamTwoPattern || !numRe.test(downstreamTwoPattern)) {
 			$.actionDialog({message : "本一批商下游二批商数量为空或格式不对"});
 			return false;
 		}
 		var annualSales =  $("#addForm input[name='annualSales']").val();
 		if (!annualSales || !numRe.test(annualSales)) {
 			$.actionDialog({message : "年销售额为空或格式不对"});
 			return false;
 		}
 		var brandLicensingArea =  $("#addForm input[name='brandLicensingArea']:checked").length;
 		if (!brandLicensingArea) {
 			$.actionDialog({message : "品牌对一批商授权经营区域为空或格式不对"});
 			return false;
 		}
 		
 		return true;
 	}
 
 	var wfStatus = $('#addForm input[name="wfStatus"]').val() || '-1';
 	if(wfStatus != -1 && wfStatus != 3){
 		$('#addForm input').attr('disabled','disabled');
		$('#addForm textarea').attr('disabled','disabled');
		$('#addForm select').attr('disabled','disabled');
 	}
	//省市区三级联动
	provinceLoad();
	function provinceLoad(){
		var provinceCode = $("#select_provinceId").attr('value');
		$.ajax({
			type: "GET",
			url:"${crmUrl}/common/findProvinces",
			dataType:"jsonp",
			jsonp:"_callback",
			success:function(result){
					$("#select_provinceId").empty();
					 $("#select_provinceId").append("<option value=''>请选择</option>"); 
					 $("#select_areaId").empty();
					 $("#select_areaId").append("<option value=''>请选择</option>"); 
					 $("#select_cityId").empty();
					 $("#select_cityId").append("<option value=''>请选择</option>");   
					 $.each(result.data,function(key,value){
					 	if(provinceCode == value[0])
						    $("#select_provinceId").append("<option value='"+value[0]+"' selected='selected'>"+value[1]+"</option>");   
						else
							$("#select_provinceId").append("<option value='"+value[0]+"'>"+value[1]+"</option>");     
					 });
					 provinceOnchange(function(){
					 	 areaOnchange();
					 });
				    
		 		}
	 	});
     };
	
	
	function provinceOnchange(callback){
		var provinceCode = $("#select_provinceId").val() || $("#select_provinceId").attr('value');
		var areaCode = $("#select_areaId").val() || $("#select_areaId").attr('value');
		if(!provinceCode){
			 $("#select_areaId").empty();
			 $("#select_areaId").append("<option value=''>请选择</option>"); 
			 $("#select_cityId").empty();
			 $("#select_cityId").append("<option value=''>请选择</option>");   			
			 return true;
		}
		$.ajax({
			type: "GET",
			url:"${crmUrl}/common/findCityByProvinceCode",
			data:{provinceCode:provinceCode},
			dataType:"jsonp",
			jsonp:"_callback",
			success:function(result){
					 $("#select_areaId").empty();
					 $("#select_areaId").append("<option value=''>请选择</option>"); 
					 $("#select_cityId").empty();
					 $("#select_cityId").append("<option value=''>请选择</option>");   
					 $.each(result.data,function(key,value){
					 	if(areaCode == value[0])
						    $("#select_areaId").append("<option value='"+value[0]+"' selected='selected'>"+value[1]+"</option>");   
						else
					 		$("#select_areaId").append("<option value='"+value[0]+"'>"+value[1]+"</option>");   
						 
					 });
					 callback &&　callback();
		 		}
	 	});
     }
	      
	 function areaOnchange(){
		var areaCode = $("#select_areaId").val() || $("#select_areaId").attr('value');
		var cityCode = $("#select_cityId").val() || $("#select_cityId").attr('value');
		if(!areaCode){
			$("#select_cityId").empty();
		    $("#select_cityId").append("<option value=''>请选择</option>");   
			return true;
		}
		$.ajax({
			type: "GET",
			url:"${crmUrl}/common/findDistrictByCityCode",
			data:{cityCode:areaCode},
			dataType:"jsonp",
			jsonp:"_callback",
			success:function(result){
				 $("#select_cityId").empty();
				 $("#select_cityId").append("<option value=''>请选择</option>");   
				 $.each(result.data,function(key,value){
				 	if(cityCode == value[0])
					    $("#select_cityId").append("<option value='"+value[0]+"' selected='selected'>"+value[1]+"</option>");   
					else
						$("#select_cityId").append("<option value='"+value[0]+"'>"+value[1]+"</option>");   
				 });
			 }
	 	});
	
			
	}
</script>







